<?php
use yii\helpers\Url;

$web = Url::base();
$integral_unit = \app\models\Mall::getCurrentInstitutionIntegralUnit();
$site_name = \app\models\Mall::getCurrentInstitutionSiteName();
$institution_code = \app\models\Mall::getCurrentInstitutionCode();
$this->title = $site_name.'->个人信息';
?>
<link rel="stylesheet" type="text/css" href="<?= $web ?>/css/mall/user-information.css"/>
<style type="text/css">
    .my-site .shipping-address .address .default {
        background: url(<?= $web ?>/images/mall/default-background.png) no-repeat;
    }
</style>
<script type="application/javascript">

    function save() {
        var user_name = $("#user_name").val();
        var phone = $("#phone").val();

        var data = {};
        data.name = user_name;
        data.phone = phone;

        requestJson("save-user-information", data, true, function (responseData) {
            alert('保存成功！');
        });

    }

</script>

<div class="my-information">
    <div class="menu fl">
        <ul>
            <li><a href="javascript:void(0)" class="cur">个人信息</a></li>
            <li><a href="user-card?institution_code=<?= $institution_code ?>">我的卡卷</a></li>
            <li><a href="user-present?institution_code=<?= $institution_code ?>"><?= $integral_unit ?>转赠</a></li>
            <li><a href="order-list?institution_code=<?= $institution_code ?>">我的订单</a></li>
            <li><a href="user-account-record?institution_code=<?= $institution_code ?>">我的<?= $integral_unit ?></a></li>
            <li><a href="user-address?institution_code=<?= $institution_code ?>">收货地址</a></li>
        </ul>
    </div>
    <div class="data fl">
        <div class="title">
            <p>基本资料</p>
        </div>
        <div class="left fl">
            <p class="point">朵拉盒不会泄露任何用户资料，手机号码不能修改！</p>
            <p class="name">用户名：<input type="text" id="user_name" value="<?php if($user_info!=null && $user_info!='') echo $user_info['name']; ?>" /><span>推荐使用中文用户名</span></p>
            <p class="phone">手机号码：<input type="text" id="phone" value="<?php if($user_info!=null && $user_info!='') echo $user_info['phone']; ?>" disabled/></p>
            <p class="duola">所属机构：<?php if($user_info!=null && $user_info!='') echo $user_info['institution_name']; ?></p>
            <input type="submit" onclick="save()" value="提交"/>
        </div>
        <div class="right fl">
            <p>当前<?= $integral_unit ?></p>
            <p><?php if($user_info!=null && $user_info!='') echo number_format($user_info['integral']); ?></p>
        </div>
    </div>
</div>